Skip to content

Comments

fix storage calculation in metrics#252

Merged
mateeullahmalik merged 6 commits intomasterfrom
fix/storage-adjustment-factor
Dec 31, 2025
Merged

fix storage calculation in metrics#252
mateeullahmalik merged 6 commits intomasterfrom
fix/storage-adjustment-factor

Conversation

@mateeullahmalik
Copy link
Collaborator

No description provided.

@roomote
Copy link

roomote bot commented Dec 30, 2025

Rooviewer Clock   See task on Roo Cloud

All issues have been addressed. The PR looks good to merge.

  • Add documentation explaining the rationale for the diskTotalAdjustFactor constant (line 55)
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

roomote[bot]
roomote bot previously approved these changes Dec 31, 2025
@a-ok123 a-ok123 self-requested a review December 31, 2025 00:35
a-ok123
a-ok123 previously approved these changes Dec 31, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to fix storage calculation in metrics by applying an adjustment factor to the reported disk total size. However, the implementation introduces critical inconsistencies in the metrics calculations.

Key Changes:

  • Added math.Floor() and a 1.034 adjustment factor to DiskTotalGb calculation
  • Added math package import
Comments suppressed due to low confidence (1)

supernode/supernode_metrics/metrics_collection.go:63

  • Fallback calculation uses unadjusted storage.TotalBytes instead of adjusted metrics.DiskTotalGb. When DiskUsagePercent is 0 and needs to be calculated, this fallback divides by storage.TotalBytes (the original unadjusted value) rather than by the adjusted metrics.DiskTotalGb value computed on line 57. This creates an inconsistency where the usage percentage would be calculated against a different total than what's reported in DiskTotalGb, potentially resulting in usage percentages that don't align with the reported total and free GB values.
		if metrics.DiskUsagePercent == 0 && storage.TotalBytes > 0 {
			used := storage.TotalBytes - storage.AvailableBytes
			metrics.DiskUsagePercent = float64(used) / float64(storage.TotalBytes) * 100

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mateeullahmalik mateeullahmalik dismissed stale reviews from a-ok123 and roomote[bot] via 3bcc47e December 31, 2025 06:45
roomote[bot]
roomote bot previously approved these changes Dec 31, 2025
@mateeullahmalik mateeullahmalik merged commit 711fd9c into master Dec 31, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants